package com.jzo2o.customer.controller.worker;

import com.jzo2o.common.utils.UserContext;
import com.jzo2o.customer.model.dto.request.BankAccountUpsertReqDTO;
import com.jzo2o.customer.model.dto.response.BankAccountResDTO;
import com.jzo2o.customer.service.IBankAccountService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @Author:zhq
 * @Date: 2025/09/18 16:45
 * @Description:
 */
@RestController
@RequestMapping("worker/bank-account")
public class WorkBankAccountController {

    @Resource
    private IBankAccountService bankAccountService;

    /**
     * 添加银行卡
     * @param bankAccountUpsertReqDTO
     */
    @PostMapping()
    public void  addAccount(@RequestBody BankAccountUpsertReqDTO bankAccountUpsertReqDTO){
        Long l = UserContext.currentUserId();
        bankAccountUpsertReqDTO.setId(l);
        bankAccountService.addAccount(bankAccountUpsertReqDTO);
    }

    @GetMapping("/currentUserBankAccount")
    public BankAccountResDTO getCurrentUserBankAccount(){
        return bankAccountService.getCurrentUserBankAccount();
    }
}
